package org.gruposp2p.proyectokarma.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.GeneratedValue;

@Entity
@Table(name="PeerAddress")
public class PeerAddress  implements java.io.Serializable {

	 private static final long serialVersionUID = 1L;
	 
	 @Id @GeneratedValue(strategy=IDENTITY)
     @Column(name="id", unique=true, nullable=false)
     private Long id;
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="addressId", nullable=false)
     private Address address;
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="peerId", nullable=false)
     private Peer peer;

    public PeerAddress() { }

    public PeerAddress(Long id, Address address, Peer peer) {
       this.id = id;
       this.address = address;
       this.peer = peer;
    }
   
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }

    public Address getAddress() {
        return this.address;
    }
    
    public void setAddress(Address address) {
        this.address = address;
    }

    public Peer getPeer() {
        return this.peer;
    }
    
    public void setPeer(Peer peer) {
        this.peer = peer;
    }

}


